﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="ExamCategoriesMgm.aspx.cs" Inherits="Skynet.RadWeb.Administration.ExamCategoriesMgm"  MasterPageFile="~/Skynet.Master"%>

<asp:Content ID="Content1" runat="server" contentplaceholderid="BodyContent">
    <table class="style1">
        <tr>
            <td>
                <asp:GridView ID="gvCategories" runat="server" AutoGenerateColumns="False" 
                    DataKeyNames="Id" DataSourceID="sdsCategories"  EnableViewState=false
                    onselectedindexchanged="gvCategories_SelectedIndexChanged">
                    <Columns>
                        <asp:CommandField ShowDeleteButton="True" ShowSelectButton="True" />
                        <asp:BoundField DataField="Id" HeaderText="Id" ReadOnly="True" 
                            SortExpression="Id" Visible="False" />
                        <asp:BoundField DataField="Title" HeaderText="Title" SortExpression="Title" />
                        <asp:BoundField DataField="Description" HeaderText="Description" 
                            SortExpression="Description" />
                        <asp:BoundField DataField="OptimisticId" HeaderText="OptimisticId" 
                            SortExpression="OptimisticId" Visible="False" />
                    </Columns>
                </asp:GridView>
            </td>
            <td>
                &nbsp;</td>
        </tr>
        <tr>
            <td>
                Detail</td>
            <td>
                &nbsp;</td>
        </tr>
        <tr>
            <td>
                <asp:DetailsView ID="dvCategory" runat="server" AutoGenerateRows="False" 
                    DataKeyNames="Id" DataSourceID="sdsWorkCategory" DefaultMode="Insert" 
                    Height="50px" Width="125px">
                    <Fields>
                        <asp:BoundField DataField="Id" HeaderText="Id" ReadOnly="True" 
                            SortExpression="Id" Visible="False" />
                        <asp:BoundField DataField="Title" HeaderText="Title" SortExpression="Title" />
                        <asp:BoundField DataField="Description" HeaderText="Description" 
                            SortExpression="Description" />
                        <asp:BoundField DataField="OptimisticId" HeaderText="OptimisticId" 
                            SortExpression="OptimisticId" Visible="False" />
                        <asp:CommandField ShowEditButton="True" ShowInsertButton="True" />
                    </Fields>
                </asp:DetailsView>
            </td>
            <td>
                &nbsp;</td>
        </tr>
        <tr>
            <td>
                <asp:SqlDataSource ID="sdsCategories" runat="server" 
                    ConnectionString="<%$ ConnectionStrings:skynetlibraryConnectionString %>" 
                    DeleteCommand="DELETE FROM [ExamCategories] WHERE [Id] = @Id" 
                    InsertCommand="INSERT INTO [ExamCategories] ([Id], [Title], [Description], [OptimisticId]) VALUES (@Id, @Title, @Description, @OptimisticId)" 
                    SelectCommand="SELECT * FROM [ExamCategories]" 
                    UpdateCommand="UPDATE [ExamCategories] SET [Title] = @Title, [Description] = @Description, [OptimisticId] = @OptimisticId WHERE [Id] = @Id">
                    <DeleteParameters>
                        <asp:Parameter Name="Id" Type="Object" />
                    </DeleteParameters>
                    <InsertParameters>
                        <asp:Parameter Name="Id" Type="Object" />
                        <asp:Parameter Name="Title" Type="String" />
                        <asp:Parameter Name="Description" Type="String" />
                        <asp:Parameter Name="OptimisticId" Type="Object" />
                    </InsertParameters>
                    <UpdateParameters>
                        <asp:Parameter Name="Title" Type="String" />
                        <asp:Parameter Name="Description" Type="String" />
                        <asp:Parameter Name="OptimisticId" Type="Object" />
                        <asp:Parameter Name="Id" Type="Object" />
                    </UpdateParameters>
                </asp:SqlDataSource>
                <asp:SqlDataSource ID="sdsWorkCategory" runat="server" 
                    ConnectionString="<%$ ConnectionStrings:skynetlibraryConnectionString %>" 
                    DeleteCommand="DELETE FROM [ExamCategories] WHERE [Id] = @Id" 
                    InsertCommand="INSERT INTO [ExamCategories] ([Id], [Title], [Description], [OptimisticId]) VALUES (@Id, @Title, @Description, @OptimisticId)" 
                    SelectCommand="SELECT * FROM [ExamCategories] WHERE ([Id] = @Id)" 
                    
                    UpdateCommand="UPDATE [ExamCategories] SET [Title] = @Title, [Description] = @Description, [OptimisticId] = @OptimisticId WHERE [Id] = @Id" 
                    oninserting="sdsWorkCategory_Inserting">
                    <DeleteParameters>
                        <asp:Parameter Name="Id" Type="Empty" />
                    </DeleteParameters>
                    <InsertParameters>
                        <asp:Parameter Name="Id" Type="Empty" />
                        <asp:Parameter Name="Title" Type="String" />
                        <asp:Parameter Name="Description" Type="String" />
                        <asp:Parameter Name="OptimisticId" Type="Empty" />
                    </InsertParameters>
                    <SelectParameters>
                        <asp:ControlParameter ControlID="gvCategories" Name="Id" 
                            PropertyName="SelectedValue" Type="Empty" />
                    </SelectParameters>
                    <UpdateParameters>
                        <asp:Parameter Name="Title" Type="String" />
                        <asp:Parameter Name="Description" Type="String" />
                        <asp:Parameter Name="OptimisticId" Type="Empty" />
                        <asp:Parameter Name="Id" Type="Empty" />
                    </UpdateParameters>
                </asp:SqlDataSource>
            </td>
            <td>
                &nbsp;</td>
        </tr>
    </table>
</asp:Content>
<asp:Content ID="Content2" runat="server" contentplaceholderid="head">
    <style type="text/css">
        .style1
        {
            width: 100%;
        }
    </style>
</asp:Content>


